*** Settings ***
Documentation    TC08-Round Management FCL-Submit Rate
Resource    ../../Keywords/Common_Head.robot
Resource    ../../Keywords/Common/Common_kw.robot
Force Tags    P1
Metadata    Author     Fiona
Metadata    ID    6854457
*** Variables ***
${TenderTitle}    TC08-Lane Management-Delete Lanes
${G_TENDERID}    AUTO 40299
${user_wendy}    xpath= //div[@data-model='availableItems']//ul//li//b[.='Wendy Jiang (WENDJIAN)']
*** Test Cases ***
TC08-Round Management FCL-Submit Rate
    ${G_TENDERID}    Generate Tender ID
    Set Suite Variable     ${G_TENDERID}
    ${PROJECT}    Copy Dictionary    ${PROJECT_PARAM}
      Set To Dictionary    ${PROJECT}
    ...    TENDER_ID=${G_TENDERID}    TENDER_TITLE=${TenderTitle}    CUSTOEMR_NAME=Miele    CUSTOMER_LEVEL=Global
          ...   MODE=FCL    DEPUTY=NATZHANG    
    Set Suite Variable    ${PROJECT}
    Step 1 Create Tender
    Step 2 User Goes To Pricing Collaboration Pricing Project
    Step 3 Input Following Attributes
    Step 4 User Selects Row That Project Name Is 20240815 FCL
    Step 5 Select This Entry Click On Copy Data Button And Yes In
    Step 6 Select Current Project In Pricing Project Click On
    Step 7 User Clicks Next Round Management Button
    Step 8 Upload Some Attachments To The Round Page
    Step 9 User sets the three region's deadline to three different time
    Step 10 User Clicks Assignment Button
    Step 11 User Selects Candidates APAC WENDJIAN EUROPE WENDJIAN
    Step 12 User Clicks Save Button
    Step 13 User Clicks Start Button
    Step 14 User Clicks Yes Button
    Step 15 User Clicks Send Button
    Step 16 Reopen This Window Switch Current User Role To Regional
    Step 17 Reopen This Window Exchange Role To Country Pricing
    Step 18 Click On Submission Button In The New Dialog Select All
    Step 19 Click On Submit Button
    Step 20 Close This Pop up Window
    Step 21 Repeat Step 17 To Step20 To Submit Rate By All
    Step 22 Exchange Current Role To Project Owner
    Step 23 Select Send Notification To All Pricing Manager
    Step 24 Check Email Received
    Step 25 Click On Close Button
    Step 26 Select This Project Click On Delete Project Button
    Step 27 User Goes To Basic Data Management Tender List



*** Keywords ***
Step ${step} Create Tender
    #************************Step 1******************************
    #  Do:
    #      User goes to Basic Data Management Tender List
    #      Click Create button
    #      Input with following attributes
    #      Tender ID some numbers such as 202408151435001 you can
    #     input with current datetime and some random number to
    #     avoid duplicate validation
    #      Tender Title some value such as Regression Test by
    #     Wendy001
    #      Customer 815 Miele
    #      Mode select all
    #      Level Global
    #      Click on Save button
    #  Expected:
    #      Created successfully with the message Tender has been
    #     added
    #************************************************************
    Login Space
    Create Tender    ${G_TENDERID}     ${TenderTitle}    815    true    true    true

Step ${step} User Goes To Pricing Collaboration Pricing Project
    #************************Step 2******************************
    #  Do:
    #      User goes to Pricing Collaboration Pricing Project
    #      User clicks Create Project button
    #  Expected:
    #      A New Project dialog should be opened successfully
    #************************************************************
    ${CurDate}    Get Current Date    result_format=%d/%m/%Y
    ${DealLineDate}    Get Current Date    UTC    +10days    result_format=%d/%m/%Y
    ${FutureDate}    Get Current Date    UTC    +100days    result_format=%d/%m/%Y
    Set To Dictionary    ${PROJECT}    DEADLINE_TM_DATE=${DealLineDate}    VALID_FROM=${CurDate}    VALID_TO=${FutureDate}
    Create Project    ${PROJECT}


Step ${step} Input Following Attributes
    #************************Step 3******************************
    #  Do:
    #      Input following attributes
    #      Tender ID 20240815 Regression
    #      Mode FCL
    #      Deadline to TM current date 10 day
    #      Rate Validity From current date
    #      Rate Validity To current date 100 day
    #      Deputies NATZHANG
    #      Description for regression
    #      Click on Save button
    #  Expected:
    #      A new project is created successfully
    #************************************************************
    Log    Done in Step 2

Step ${step} User Selects Row That Project Name Is 20240815 FCL
    #************************Step 4******************************
    #  Do:
    #      User selects row that project name is 20240815 FCL
    #     Regression
    #      Click on Copy Data
    #      In the pop up dialog input Tender ID with value
    #     2024000001 click on Search button
    #  Expected:
    #      index php attachments get b3256194 701d 4b1d a71b
    #     7de2f84b3f5e Result list has one entry as above
    #     information
    #************************************************************
    Search Project    ${G_TENDERID}
    Copy Data    2024000001    FCL    do not touch me

Step ${step} Select This Entry Click On Copy Data Button And Yes In
    #************************Step 5******************************
    #  Do:
    #      Select this entry click on Copy Data button and Yes in
    #     pop up window
    #  Expected:
    #      Successfully with messages in pop up window
    #      Tender has been successfully copied from 2024000001 FCL
    #     do not touch me
    #      Please adjust the template and the lanes in Template
    #     Lane Management page if required
    #      After click on OK button
    #      The same message is displayed in Pricing Project page
    #     too
    #************************************************************
    Log    Done in step 5

Step ${step} Select Current Project In Pricing Project Click On
    #************************Step 6******************************
    #  Do:
    #      Select current project in pricing project click on
    #     template management button
    #      Click Skip button in Step4 and Yes in the pop up
    #     windown
    #  Expected:
    #      Next Round Management button is enable
    #************************************************************
    ${project_name}   Set Variable    ${G_TENDERID}-FCL-${TENDER_TITLE}
    Set Test Variable    ${project_name}    ${project_name}
    Click    xpath = //td[.='${project_name}']
    Wait Until Keyword Succeeds    5x    300ms    Click    ${Project_toolbar_TemplateManagementButton}
    Sleep    4
    Click    ${Template_SkipSendToGPDButton}
    Check Text Value    ${SkipSendToGPDMessage}    Are you sure to skip push pricing?
    Click    ${SkipSendToGPD_Yes}
    Wait Until Keyword Succeeds   60    1    Get Element States    ${Template_NextRoundManagementButton}     contains    visible
    


Step ${step} User Clicks Next Round Management Button
    #************************Step 7******************************
    #  Do:
    #      User clicks Next round management button
    #  Expected:
    #      A dialogue appears The current role is project owner
    #      It divides into 5 parts
    #      1 Generation Information current Pricing Round 1
    #     Started 2 lanes check the project information is right
    #     with actual condition
    #      2 Assignment
    #      3 Attached Document
    #      4 Round History
    #      5 The tasks status Region Country My tasks
    #************************************************************
    Wait Until Keyword Succeeds    5x    300ms    Click    ${Template_NextRoundManagementButton}
    Wait For Elements State    //h4/span[contains(text(),"Project ${G_TENDERID}-FCL-${TenderTitle}")]
    Wait For Elements State    //legend[.="Generation Information"]
    Wait For Elements State    //legend[.="Assignment"]
    Wait For Elements State    //legend[.="Attached Document"]
    Wait For Elements State    //legend[.="Round History"]
    Wait For Elements State    //a[.="Region"]
    Wait For Elements State    //a[.="My Tasks"]

Step ${step} Upload Some Attachments To The Round Page
    #************************Step 8******************************
    #  Do:
    #      Upload some attachments to the round page
    #  Expected:
    #      The attachments uploaded successfully
    #************************************************************
    Click    ${Project_RoundMgmt_Attach_UploadButton}
    Upload File By Selector    ${upload_addFileButton}    Cases${/}FCL MODE${/}TestData${/}FCLTemplate_IPT-all.xlsx
    Sleep    4
    Get Element States    //tr//td[.='FCLTemplate_IPT-all.xlsx']    contains    visible
Step ${step} User sets the three region's deadline to three different time
    #************************Step 9******************************
    #  Do:
    #      User sets the three region's deadline to three different time.
    #     APAC: current date+10
    #     EUROPE: current date+10
    #     NAM: current date+10
    #  Expected:
    #      It can set successfully.
    #************************************************************
    Wait For Elements State    //input[@id='regionAssignmet_Date_0_0']    visible    30
    ${Date}    Get Current Date    local    +10days    result_format=%d/%m/%Y
    Input Deadline In Region Tab    0    0    ${Date}
    Input Deadline In Region Tab    0    1    ${Date}
    Input Deadline In Region Tab    1    0    ${Date}
Step ${step} User Clicks Assignment Button
    #************************Step 9******************************
    #  Do:
    #      User clicks assignment button
    #  Expected:
    #      There are three tabs in the dialogue APAC Europe NAM
    #************************************************************
    Wait Until Keyword Succeeds    5x    100ms    Click    ${Project_RoundMgmt_AssignButton}
    Wait For Elements State    ${Project_RoundMgmt_Assign_ApacTab}    visible    timeout=10s
    Wait For Elements State    ${Project_RoundMgmt_Assign_EuropeTab}    visible    timeout=10s
    Wait For Elements State    ${Project_RoundMgmt_Assign_NamTab}    visible    timeout=10s  
Step ${step} User Selects Candidates APAC WENDJIAN EUROPE WENDJIAN
    #************************Step 10******************************
    #  Do:
    #      User selects candidates APAC WENDJIAN EUROPE WENDJIAN
    #     NAM WENDJIAN
    #  Expected:
    #      They can be selected successfully
    #************************************************************
    Click    xpath= //div[@data-model='selectedItems']
    Round Mgmt Assign User    ${Project_RoundMgmt_Assign_ApacTab}    xpath= //div[@data-model='availableItems']//ul//li//b[.='Wendy Jiang (WENDJIAN)']
    Round Mgmt Assign User    ${Project_RoundMgmt_Assign_EuropeTab}    xpath= //div[@data-model='availableItems']//ul//li//b[.='Wendy Jiang (WENDJIAN)']
    Round Mgmt Assign User    ${Project_RoundMgmt_Assign_NamTab}    xpath= //div[@data-model='availableItems']//ul//li//b[.='Wendy Jiang (WENDJIAN)']
    

Step ${step} User Clicks Save Button
    #************************Step 11******************************
    #  Do:
    #      User clicks save button
    #  Expected:
    #      The assignment disappears The regional tab shows the
    #     selected candidates
    #************************************************************
    Click    ${Project_RoundMgmt_Assign_SaveButton}
    Wait Until Search Finished
    
Step ${step} User Clicks Start Button
    #************************Step 13******************************
    #  Do:
    #      User clicks start button
    #  Expected:
    #      A dialogue appears It asks are you sure to start round
    #     and there is a default check box below it The check box
    #     is checked and the name is send notification to regional
    #     pricing manager
    #************************************************************
    Click    //tr//td[.='FCLTemplate_IPT-all.xlsx']/preceding-sibling::td/input[3]
    Click    ${Project_RoundMgmt_StartButton}
    Wait For Elements State    //label[.='Are you sure to start round1?']    timeout=10s
    Wait For Elements State    //span[.='Send notification to regional pricing manager.']/preceding-sibling::input[@data-ng-checked='isCheckboxChecked']    timeout=10s
    


Step ${step} User Clicks Yes Button
    #************************Step 14******************************
    #  Do:
    #      User clicks yes button
    #  Expected:
    #      A new notification appears
    #      index php attachments get 94ab2560 6e3c 421f 8724
    #     d3ae53156f79
    #************************************************************
    Wait Until Keyword Succeeds    10x    100ms    Click    ${Project_RoundMgmt_StartConfirmButton} 
    Wait Until Search Finished
    Wait For Elements State    //p[.='Dear Colleagues,']    detached    timeout=10s
    Wait For Elements State    //p[.='You have been assigned as Regional Pricing Lead for project Project Name.']    detached    timeout=10s
    Wait For Elements State    //p[.='Please submit following lanes before the deadline:']    detached    timeout=10s
    Wait For Elements State    //p[.='User Role - Related Lane Number - Deadline']   detached    timeout=10s
    Wait For Elements State    //p[.='Here is the project description: Project Description.']    detached    timeout=10s
    Wait For Elements State    //p[.='Here is the link to the corresponding Pricing site: Pricing Round Submission URL']    detached    timeout=10s
Step ${step} User Clicks Send Button
    #************************Step 15******************************
    #  Do:
    #      User clicks send button
    #  Expected:
    #      In generation information it shows current pricing
    #     Round 1 Started 2 lanes
    #      The project owner will received three letters
    #      The regional pricing leader will also receive a letter
    #      The format are as
    #      index php attachments get 15a0dd59 63e7 4cb2 8fab
    #     a800c0620c51
    #************************************************************
    Wait Until Keyword Succeeds    20x    100ms    Click    ${Project_RoundMgmt_Confirm_SendButton}
    Wait Until Search Finished
Step ${step} Reopen This Window Switch Current User Role To Regional
    #************************Step 16******************************
    #  Do:
    #      Reopen this window, Switch current user role to Regional Pricing Manager(EUROPE,NAM,APAC).
    #     In Assignment, assign WENDJIAN to each Country and Cluster.
    #     Set deadline as:
    #     Country
    #     AU: current date -1
    #     CN-C: current date +10
    #     DE: current date
    #     US: current date
    #     Trade Lane Standard:
    #     APAC-US: current date -1
    #     EMNEU-APOCE: current date +10
    #     Cluster
    #     Australia & New Zealand: current date-1
    #     Germany & Switzerland: current date +10
    #     Greater China: current date
    #     Trade Lane Manager Europe: current date
    #     Trade Lane Manager NAM: current date
    #     Send Notification.
    #  Expected:
    #      The country pricing leader will also receive a letter
    #      The format are as
    #      index php attachments get b87684dc e4fc 4f71 a822
    #     e79c00c7a108
    #************************************************************
    Close Browser
    Set Global Variable    ${USERNAME}    WENDJIAN
    Login Space
    Search Project    ${PROJECT.TENDER_ID}
    Wait Until Search Finished
    Wait Until Keyword Succeeds    10x    500ms    Click    ${Project_toolbar_RoundMgmtButton}
    Assign My Current Role    Regional Pricing Manager(EUROPE,NAM,APAC)
    ${Date1}    Get Current Date    UTC    -1days    result_format=%d/%m/%Y
    ${Date2}    Get Current Date    UTC    +10days    result_format=%d/%m/%Y
    ${Date3}    Get Current Date    UTC    result_format=%d/%m/%Y
    Input Deadline In Country Tab    0    0    ${Date1}
    Input Deadline In Country Tab    0    1    ${Date2}
    Input Deadline In Country Tab    1    0    ${Date3}
    Input Deadline In Country Tab    1    1    ${Date3}
    Click    //a[.='Trade Lane Standard']
    Input Deadline In TradeLaneStandard Tab    0    0    ${Date1}
    Input Deadline In TradeLaneStandard Tab    0    1    ${Date2}
    Click    //a[.='Cluster']
    Input Deadline In Cluster Tab    0    0    ${Date1}
    Input Deadline In Cluster Tab    0    1    ${Date2}
    Input Deadline In Cluster Tab    1    0    ${Date3}
    Input Deadline In Cluster Tab    1    1    ${Date3}
    Input Deadline In Cluster Tab    2    0    ${Date3}
    Wait Until Keyword Succeeds    5x    100ms    Click    ${Project_RoundMgmt_AssignButton}
    Round Mgmt Assign User    (//a[.='Country'])[1]    ${user_wendy}    //a[.='AU']    
    Round Mgmt Assign User    (//a[.='Country'])[1]    ${user_wendy}    //a[.='CN-C'] 
    Round Mgmt Assign User    (//a[.='Country'])[1]    ${user_wendy}    //a[.='DE'] 
    Round Mgmt Assign User    (//a[.='Country'])[1]    ${user_wendy}    //a[.='US']
    Round Mgmt Assign User    (//a[.='Cluster'])[1]    ${user_wendy}    //a[.='Australia & New Zealand']
    Round Mgmt Assign User    (//a[.='Cluster'])[1]    ${user_wendy}    //a[.='Germany & Switzerland']
    Round Mgmt Assign User    (//a[.='Cluster'])[1]    ${user_wendy}    //a[.='Greater China']
    Round Mgmt Assign User    (//a[.='Cluster'])[1]    ${user_wendy}    //a[.='Trade Lane Manager Europe']
    Round Mgmt Assign User    (//a[.='Cluster'])[1]    ${user_wendy}    //a[.='Trade Lane Manager NAM']
    Click    ${Project_RoundMgmt_Assign_SaveButton}
    Wait Until Search Finished
    Click    //button/span[.='Confirm']
    Wait Until Keyword Succeeds    20x    300ms    Click    ${Project_RoundMgmt_SendNotifButton}
    Wait Until Keyword Succeeds    20x    100ms    Click    ${Project_RoundMgmt_Confirm_SendButton}
    Wait Until Search Finished
    
Step ${step} Reopen This Window Exchange Role To Country Pricing
    #************************Step 17******************************
    #  Do:
    #      Reopen this window exchange role to Country Pricing
    #     Manager US
    #      clicks download button in generation information
    #  Expected:
    #      The file can be downloaded successfully
    #      Update some value of the rates
    #************************************************************
    Click    //button[.='Close']
    Search Project    ${PROJECT.TENDER_ID}
    Wait Until Search Finished
    Wait Until Keyword Succeeds    10x    500ms    Click    ${Project_toolbar_RoundMgmtButton}
    Sleep    2
    Assign My Current Role    Country Pricing Manager(US)
    ${filename}    Download File    //button[.='Download IPT']
    Set Test Variable    ${filename}    ${filename}
    Wait Until Search Finished
    Open Excel Document     ${filename}    ${PROJECT.MODE}_D
    Write Excel Cell    5    297   0
    Write Excel Cell    5    298   0
    Write Excel Cell    5    299   0
    Write Excel Cell    5    301   0
    Write Excel Cell    5    323   0
    Write Excel Cell    5    324   0
    Write Excel Cell    5    325  0
    Write Excel Cell    5    326   0
    Write Excel Cell    5    329   0
    Write Excel Cell    5    84    200
    Write Excel Cell    5    168    100
    Save Excel Document    ${filename}
    Close All Excel Documents

Step ${step} Click On Submission Button In The New Dialog Select All
    #************************Step 18******************************
    #  Do:
    #      Click on Submission button in the new dialog Select All
    #     Upload the updated file
    #  Expected:
    #      In Step2 Summary SUCCESSFUL
    #      Your selected lanes have been uploaded
    #      In Step3 Submit button is displayed
    #************************************************************
    Click    ${Project_RoundMgmt_SubmissionButton}
    Click    ${Project_RoundMgmt_Submit_SelectAll}
    Click    xpath=//button[.='Upload']
    Wait For Elements State   ${upload_addFileButton}     enabled
    Sleep    2
    Upload File By Selector    ${upload_addFileButton}    ${filename}
    # Upload File By Selector    ${upload_addFileButton}    Cases${/}FCL MODE${/}TestData${/}AUTO 64432-FCL-TC08-Lane Management-Delete Lanes_Round1_IPT_11062024_Hh.xlsx 
    # ${filename1}    Download File    //button[contains(.,'Error Report')]

Step ${step} Click On Submit Button
    #************************Step 19******************************
    #  Do:
    #      Click on Submit button
    #  Expected:
    #      It displays
    #      Summary SUCCESSFUL
    #      Your rates have been submitted
    #      under Step 3
    #************************************************************
    Wait Until Search Finished
    Wait Until Search Finished
    Wait Until Keyword Succeeds    10x    1s    Get Text    css = [data-ng-if='submission.success']    contains    Summary: SUCCESSFUL
    Get Text    css = [data-ng-if='submission.success']    contains    Your selected lanes have been uploaded!
    # Remove All Files
   

Step ${step} Close This Pop up Window
    #************************Step 20******************************
    #  Do:
    #      Close this pop up window
    #      Check the role part
    #      Check the task Country Cluster tab
    #      Download IPT to check
    #      Check the email receieved
    #  Expected:
    #      Background color is green index php attachments get
    #     7f1479aa 3455 4420 8c31 d576acda3d85
    #      index php attachments get db2ce3fc 03ea 4bec abe8
    #     841cfeabeb6f
    #      The rates should be the same as updated file
    #      index php attachments get df6cef47 3672 4f85 9a4d
    #     f0410a5c2d5e
    #************************************************************
    Click    ${Project_RoundMgmt_Submit_SubmitButton}
    Wait Until Keyword Succeeds    10x    400ms    Get Page Source    contains        Your rates have been submitted!
    Click    ${Project_RoundMgmt_Submit_CloseButton}
    Wait For Elements State    //div[@class="custom-select"]/div[contains(text(),"Country Pricing Manager(US)")]    visible    timeout=10s
    Wait For Elements State    //td[.='US']/following-sibling::td//div/span[.='1/1']    visible    timeout=10s
    Wait For Elements State    //td[.='US']/following-sibling::td[.='Completed']    visible    timeout=10s
    ${style}    Get Attribute    //div[@class="custom-select"]/div[contains(text(),"Country Pricing Manager(US)")]/span    style
    Should Contain    ${style}    background:green
Step ${step} Repeat Step 17 To Step20 To Submit Rate By All
    #************************Step 21******************************
    #  Do:
    #      Repeat step 17 to Step20 to submit rate by all
    #     countries trade lanes clusters regions
    #  Expected:
    #      As step 17 to Step20
    #************************************************************
    Assign My Current Role    Country Pricing Manager(DE,AU,CN-C,US)
    ${filename2}    Download File    //button[.='Download IPT']
    Set Test Variable    ${filename2}    ${filename2}
    Wait Until Search Finished
    Open Excel Document     ${filename2}    ${PROJECT.MODE}_D
    Write Excel Cell    6    79   0
    Write Excel Cell    6    80   0
    Write Excel Cell    6    81   0
    Write Excel Cell    6    82   0
    Write Excel Cell    6    85   0
    Write Excel Cell    6    94   10
    Write Excel Cell    5    94   10
    Write Excel Cell    5    142  0
    Write Excel Cell    6    142   0
    Write Excel Cell    5    143  0
    Write Excel Cell    6    143   0
    Write Excel Cell    5    144  0
    Write Excel Cell    6    144   0
    Write Excel Cell    5    146  0
    Write Excel Cell    6    146   0
    Write Excel Cell    6    297   0
    Write Excel Cell    6    298   0
    Write Excel Cell    6    299   0
    Write Excel Cell    6    84    0
    Write Excel Cell    6    301   0
    Save Excel Document    ${filename2}
    Close All Excel Documents
    Click    ${Project_RoundMgmt_SubmissionButton}
    Click    ${Project_RoundMgmt_Submit_SelectAll}
    Click    xpath=//button[.='Upload']
    Wait For Elements State   ${upload_addFileButton}     enabled
    Sleep    2
    Upload File By Selector    ${upload_addFileButton}    ${filename2}
    Wait Until Search Finished
    Wait Until Search Finished
    Wait Until Keyword Succeeds    10x    1s    Get Text    css = [data-ng-if='submission.success']    contains    Summary: SUCCESSFUL
    Get Text    css = [data-ng-if='submission.success']    contains    Your selected lanes have been uploaded!
    # Remove All Files
    Click    ${Project_RoundMgmt_Submit_SubmitButton}
    Wait Until Keyword Succeeds    10x    400ms    Get Page Source    contains        Your rates have been submitted!
    Click    ${Project_RoundMgmt_Submit_CloseButton}
    Wait For Elements State    //div[@class="custom-select"]/div[contains(text(),"Country Pricing Manager(DE,AU,CN-C,US)")]    visible    timeout=10s
    Wait For Elements State    //td[.='DE']/following-sibling::td//div/span[.='1/1']    visible    timeout=10s
    Wait For Elements State    //td[.='DE']/following-sibling::td[.='Completed']    visible    timeout=10s
    Wait For Elements State    //td[.='AU']/following-sibling::td//div/span[.='1/1']    visible    timeout=10s
    Wait For Elements State    //td[.='AU']/following-sibling::td[.='Completed']    visible    timeout=10s
    Wait For Elements State    //td[.='CN-C']/following-sibling::td//div/span[.='1/1']    visible    timeout=10s
    Wait For Elements State    //td[.='CN-C']/following-sibling::td[.='Completed']    visible    timeout=10s
    Assign My Current Role    Cluster Head(TLM-EU,GREATER CHINA,TLM-NAM,AU-NZ,DE-CH)
    ${filename3}    Download File    //button[.='Download IPT']
    Set Test Variable    ${filename3}    ${filename3}
    Wait Until Search Finished
    Open Excel Document     ${filename3}    ${PROJECT.MODE}_D
    Write Excel Cell    6    206   Direct
    Write Excel Cell    5    232   0
    Write Excel Cell    6    232   0
    Write Excel Cell    5    233   0
    Write Excel Cell    6    233   0
    Write Excel Cell    5    234   0
    Write Excel Cell    6    234   0
    Write Excel Cell    5    254   0
    Write Excel Cell    6    254   0
    Write Excel Cell    5    255   0
    Write Excel Cell    6    255   0
    Write Excel Cell    5    256   0
    Write Excel Cell    6    256   0
    
    Save Excel Document    ${filename3}
    Close All Excel Documents
    Click    ${Project_RoundMgmt_SubmissionButton}
    Click    ${Project_RoundMgmt_Submit_SelectAll}
    Click    xpath=//button[.='Upload']
    Wait For Elements State   ${upload_addFileButton}     enabled
    Sleep    2
    Upload File By Selector    ${upload_addFileButton}    ${filename3}
    Wait Until Search Finished
    Wait Until Search Finished
    Wait Until Keyword Succeeds    10x    1s    Get Text    css = [data-ng-if='submission.success']    contains    Summary: SUCCESSFUL
    Get Text    css = [data-ng-if='submission.success']    contains    Your selected lanes have been uploaded!
    # Remove All Files
    Click    ${Project_RoundMgmt_Submit_SubmitButton}
    Wait Until Keyword Succeeds    10x    400ms    Get Page Source    contains        Your rates have been submitted!
    Click    ${Project_RoundMgmt_Submit_CloseButton}
    Wait For Elements State    //div[@class="custom-select"]/div[contains(text(),"Cluster Head(TLM-EU,GREATER CHINA,TLM-NAM,AU-NZ,DE-CH)")]    visible    timeout=10s
    Click    //a[.='Cluster']
    Wait For Elements State    //td[.='Australia & New Zealand']/following-sibling::td//div/span[.='1/1']    visible    timeout=10s
    Wait For Elements State    //td[.='Australia & New Zealand']/following-sibling::td[.='Completed']    visible    timeout=10s
    Wait For Elements State    //td[.='Germany & Switzerland']/following-sibling::td//div/span[.='1/1']    visible    timeout=10s
    Wait For Elements State    //td[.='Germany & Switzerland']/following-sibling::td[.='Completed']    visible    timeout=10s
    Wait For Elements State    //td[.='Greater China']/following-sibling::td//div/span[.='1/1']    visible    timeout=10s
    Wait For Elements State    //td[.='Greater China']/following-sibling::td[.='Completed']    visible    timeout=10s
    Wait For Elements State    //td[.='Trade Lane Manager Europe']/following-sibling::td//div/span[.='1/1']    visible    timeout=10s
    Wait For Elements State    //td[.='Trade Lane Manager Europe']/following-sibling::td[.='Completed']    visible    timeout=10s
    Wait For Elements State    //td[.='Trade Lane Manager NAM']/following-sibling::td//div/span[.='1/1']    visible    timeout=10s
    Wait For Elements State    //td[.='Trade Lane Manager NAM']/following-sibling::td[.='Completed']    visible    timeout=10s

    Assign My Current Role    Regional Pricing Manager(EUROPE,NAM,APAC)
    ${filename4}    Download File    //button[.='Download IPT']
    Set Test Variable    ${filename4}    ${filename4}
    Wait Until Search Finished
    Click    ${Project_RoundMgmt_SubmissionButton}
    Click    ${Project_RoundMgmt_Submit_SelectAll}
    Sleep    2
    Click    xpath=//button[.='Upload']
    Wait For Elements State   ${upload_addFileButton}     enabled
    Sleep    2
    Upload File By Selector    ${upload_addFileButton}    ${filename4}
    Wait Until Search Finished
    Wait Until Search Finished
    Wait Until Keyword Succeeds    10x    1s    Get Text    css = [data-ng-if='submission.success']    contains    Summary: SUCCESSFUL
    Get Text    css = [data-ng-if='submission.success']    contains    Your selected lanes have been uploaded!
    # Remove All Files
    Click    ${Project_RoundMgmt_Submit_SubmitButton}
    Wait Until Keyword Succeeds    10x    400ms    Get Page Source    contains        Your rates have been submitted!
    Click    ${Project_RoundMgmt_Submit_CloseButton}
    Wait For Elements State    //div[@class="custom-select"]/div[contains(text(),"Regional Pricing Manager(EUROPE,NAM,APAC)")]    visible    timeout=10s



Step ${step} Exchange Current Role To Project Owner
    #************************Step 22******************************
    #  Do:
    #      Exchange current role to Project Owner
    #      Click on Close Round button
    #  Expected:
    #      An pop up window Close Round1_ProjectName
    #      Are you sure you want to close the pricing round
    #      3 options
    #      Send notification to regional pricing manager
    #      Send notification to all pricing manager
    #      Do not send notification to anyone
    #************************************************************
    Assign My Current Role    Project Owner
    Wait Until Keyword Succeeds    20x    100ms    Click    ${Project_RoundMgmt_CloseRoundButton}
    ${project_name}   Set Variable    ${G_TENDERID}-FCL-${TENDER_TITLE}
    Set Test Variable    ${project_name}    ${project_name}
    Wait For Elements State    //h4[.='Close Round1_${project_name}']    visible    timeout=10s 
    Wait For Elements State    //label[.='Are you sure you want to close the pricing round?']    visible    timeout=10s 
    Wait For Elements State    //span[.='Send notification to all pricing manager.']    visible    timeout=10s 
    Wait For Elements State    //span[.='Send notification to all pricing manager.']    visible    timeout=10s
    Wait For Elements State    //span[.='Do not send notification to anyone.']    visible    timeout=10s
  
Step ${step} Select Send Notification To All Pricing Manager
    #************************Step 23******************************
    #  Do:
    #      Select Send notification to all pricing manager
    #      User clicks yes button
    #  Expected:
    #      1 A prompt says Close Success
    #      2 Current Pricing Round 1 Closed 2 lanes
    #      3 There have new round button and reopen round button
    #************************************************************
    click    //span[.='Send notification to all pricing manager.']
    click    ${Project_RoundMgmt_StartConfirmButton}
    Wait Until Keyword Succeeds    20x    100ms    Get Page Source    contains        Close Success
    Get Element States    //div/b[.='Current Pricing Round']    contains    visible
    Get Element States    //div/b[.='1 (Closed) 2 lanes']    contains    detached 
    Get Element States    ${Project_RoundMgmt_NewRoundButton}    contains    visible
    Get Element States    ${Project_RoundMgmt_ReopenRoundButton}    contains    visible 

Step ${step} Check Email Received
    #************************Step 24******************************
    #  Do:
    #      Check email received
    #  Expected:
    #      index php attachments get de7fc98c 227e 45d2 b7ef
    #     469a7df5315a The format and description are as above
    #************************************************************
    Log    Cannot check in automation

Step ${step} Click On Close Button
    #************************Step 25******************************
    #  Do:
    #      Click on Close button
    #      In Pricing Project page User selects TenderID Contains
    #     20240815
    #  Expected:
    #      The project 20240815 FCL Regression could be found
    #************************************************************
    Click    ${Project_RoundMgmt_CloseButton}
    Wait For Elements State    //td[contains(text(),'${G_TENDERID}')]    visible    20
    close browser
    Set Global Variable    ${USERNAME}    AUTOTEST
    Login Space

Step ${step} Select This Project Click On Delete Project Button
    #************************Step 26******************************
    #  Do:
    #      Select this project click on Delete Project button
    #      Click Yes of the pop up confirm window
    #      If Delete Project button is disable do Data Cleaning
    #     and cancel first and then Delete Project button is
    #     enable
    #  Expected:
    #      System displays Project has been deleted
    #************************************************************
    Click DataClean For Delete
    LOG    Done in teardown

Step ${step} User Goes To Basic Data Management Tender List
    #************************Step 27******************************
    #  Do:
    #      User goes to Basic Data Management Tender List
    #      Search out the tender created in step1
    #      Click on Delete button
    #      Click on Yes button in the popup dialog
    #  Expected:
    #      System displays Tender has been deleted
    #************************************************************
    LOG    Done in teardown


